<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page isELIgnored="false" %> 

<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@ page import="net.ssta.core.db.PagingInfo"%>

<%
	String path = request.getContextPath();
	//分页参数
    PagingInfo pagingInfo =(PagingInfo) request.getAttribute("pagingInfo");
    
	RecordSet rs=(RecordSet)request.getAttribute("RECORDSET");
	if(rs==null){rs=new RecordSet();}
	
	 int pageno = pagingInfo.getCurrentPageNo();
	 Record  searRecord=(Record)request.getAttribute("searchData");
	 if(searRecord==null){
		 searRecord=new Record();
	 }
	 
	 String userId=request.getParameter("userId");
%>


 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<link type="text/css" rel="stylesheet" href="<%=path %>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path %>/includes/styleBase/css/ostable.css" />
<link rel="stylesheet" href="<%=path %>/includes/lhgdialog/lhgdialog.css" />


<script type='text/javascript' src="<%=path %>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/includes/styleBase/js/style.js"></script>
<script type="text/javascript" src="<%=path %>/includes/DatePicker/WdatePicker.js"></script>


<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path %>/includes/lhgdialog/lhgdialog.js"></script>



<title>机构信息列表</title>
 <script>
var dg = frameElement.dg;
$(document).ready(function()
{
    dg.addBtn( 'save', '关联', save );
	dg.addBtn( 'cancel', '取消', cancel );
});
function cancel()
{
  dg.cancel();
}

function save()
{
	var v=$("input:[name=UNITID]:checked").val();
	if(v==null){
	  alert("您必须选择一个机构");
	  return;
	}
		
	var v1=$("#userId").val();
 	  $.ajax({ 
		type: "POST", url: "<%=path%>/back/userManager?method=setUnitUser",
		data:'userId='+v1+"&unitId="+v,
		error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
		success: function (msg) {
			if("true"==msg){
			   alert("关联成功");
			   dg.win.reloadPage();
			   return false;
			}else{
			   alert("关联失败，请稍后重试");
			}
		    return true;
		}
	});
}


	
 </script>
</head>
<body>
 
	<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left">&nbsp;</td>
      <td class="box_top_center">机构查询</td>
      <td class="box_top_right">&nbsp;</td>
    </tr>
  </table>
</div>

<form name="_sForm" action="<%=path %>/back/userManager?method=unitList" method="post">
<input type="hidden" name="search_USERID" id="userId" value="<%=searRecord.getString("USERID",userId) %>"/>
	<div class="infoDiv">
	  <table border="0" cellpadding="0" cellspacing="0" class="trHeightTable">
	    <tr>
	      <td class="leftTipArea">机构名：</td>
	      <td><input  name="search_UNITNAME" class="textInput" style="width:120px;" value="<%=searRecord.getString("UNITNAME","") %>"/></td>
	    
	      
	     <td width="30px">&nbsp;</td>
	      <td>
	      	<a href="#2010" class="imgButton" onclick="document._sForm.submit()"><span>查询</span></a>
	      </td>
	    </tr>
	  </table>
	</div>
</form>

<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left" width="2">&nbsp;</td>
      <td class="box_top_center">查询结果列表</td>
      <td class="box_top_right" width="2">&nbsp;</td>
    </tr>
  </table>
</div>

<div class="contentBox">
    <table class="osTable" cellpadding="0" cellspacing="0" border="0">
      <thead>
        <tr >
          <th  width="6%" >选择</th>
          <th  width="30%" >机构名称</th>
          <th  width="30%">详细地址</th>
          <th  width="20%">单位电话</th>
          <th  width="15%">单位网址</th>
        </tr>
      </thead>
      <tbody>
        <%
           int i=0;
           for(i=0;i<rs.size();i++){
        	   Record r=rs.get(i);
        %>
	 
	 <tr>
	 	<td><input name="UNITID" type="radio" value="<%=r.getString("UNITID") %>"/>&nbsp;</td>
	    <td><%=r.getString("ITEM_9","") %>&nbsp;</td>
	    <td><%=r.getString("ITEM_37","") %>&nbsp;</td>
	    <td><%=r.getString("ITEM_39","") %>&nbsp;</td>
	    <td><%=r.getString("Item_60","") %>&nbsp;</td>
	 </tr>
	 <%} for(;i<5;i++){%>
	<tr>
		 <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	 </tr>
	 <%} %>
      </tbody>
    </table>
	<div class="navDiv">
    <div class="navLeftDiv">
       &nbsp;
    </div>
    
    <div class="navRightDiv">  
    	 <jsp:include flush="true" page="/common/paging.jsp"></jsp:include>
	</div>
</div>
</div>
</body> 
</html>